package com.thb.pay.api.agent;


import com.thb.pay.core.utils.PageResult;
import com.thb.pay.vo.req.AgentAccountPageReq;
import com.thb.pay.vo.resp.AgentAccountVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>
 * 代理商-账户 api
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@FeignClient(value = "pay-service", fallbackFactory = AgentAccountServiceApiFallbackFactory.class)
@RequestMapping("/agentAccountApi")
public interface AgentAccountServiceApi {

    /**
     * @param pageReq 分页参数
     * @Description 分页获取 代理商-账户信息
     * @Author lucky
     * @data 2019/7/21 22:10
     */
    @RequestMapping(value = "/findPage", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    PageResult<AgentAccountVo> findPage(@RequestBody AgentAccountPageReq pageReq);

    /**
     * @param agentId 代理商ID
     * @Description 获取代理商账户详情
     * @Author lucky
     * @data 2019/7/21 22:12
     */
    @RequestMapping(value = "/getById", method = RequestMethod.GET)
    AgentAccountVo getById(@RequestParam("agentId") Long agentId);

    /**
     * @param agentId 代理商id
     * @param amount  变动金额
     * @param bizType 业务类型,1-分润,2-提现,3-调账
     * @param bizItem 业务类目:10-余额,11-代付余额,12-冻结金额,13-保证金,20-支付,21-代付,22-线下充值,23-线上充值
     * @param orderId 订单id 【业务单 可选】
     * @Description 给代理商户加款
     * @Author lucky
     * @data 2019/7/25 23:56
     */
    @RequestMapping(value = "/increaseAmountToAccount", method = RequestMethod.GET)
    void increaseAmountToAccount(@RequestParam("agentId") Long agentId,
                                 @RequestParam("amount") Long amount,
                                 @RequestParam("bizType") Integer bizType,
                                 @RequestParam("bizItem") String bizItem,
                                 @RequestParam("orderId") String orderId);

    /**
     * @param agentId 代理商id
     * @param amount  变动金额
     * @param bizType 业务类型,1-分润,2-提现,3-调账
     * @param bizItem 业务类目:10-余额,11-代付余额,12-冻结金额,13-保证金,20-支付,21-代付,22-线下充值,23-线上充值
     * @Description 给代理商账户减款款
     * @Author lucky
     * @data 2019/7/25 23:48
     */
    @RequestMapping(value = "/decreaseAmountToAccount", method = RequestMethod.GET)
    void decreaseAmountToAccount(@RequestParam("agentId") Long agentId,
                                 @RequestParam("amount") Long amount,
                                 @RequestParam("bizType") Integer bizType,
                                 @RequestParam("bizItem") String bizItem);


    /**
     * @param agentId      代理商id
     * @param freezeAmount 冻结金额
     * @Description 冻结代理商账户金额(增加用户不可用金额)
     * @Author lucky
     * @data 2019/7/25 23:59
     */
    @RequestMapping(value = "/freezeAmountToAccount", method = RequestMethod.GET)
    void freezeAmountToAccount(@RequestParam("agentId") Long agentId,
                               @RequestParam("freezeAmount") Long freezeAmount);


    /**
     * @param agentId        代理商id
     * @param unfreezeAmount 解冻金额
     * @param requestNo      请求单号
     * @param bizType        业务类型,1-分润,2-提现,3-调账
     * @Description 解冻代理商账户金额 并减款(减少账户余额 + 减少账户不可用金额 + 减少账户可结算金额)
     * @Author lucky
     * @data 2019/7/25 23:59
     */
    @RequestMapping(value = "/unFreezeAmountToAccount", method = RequestMethod.GET)
    void unFreezeAmountToAccount(@RequestParam("agentId") Long agentId,
                                 @RequestParam("unfreezeAmount") Long unfreezeAmount,
                                 @RequestParam("requestNo") String requestNo,
                                 @RequestParam("bizType") Integer bizType);

    /**
     * @param agentId        代理商id
     * @param unfreezeAmount 解冻金额
     * @Description 结算失败：解冻  结算失败给代理商账户解冻金额(减少账户不可用金额)
     * @Author lucky
     * @data 2019/7/26 0:03
     */
    @RequestMapping(value = "/unFreezeSettAmountToAccount", method = RequestMethod.GET)
    void unFreezeSettAmountToAccount(@RequestParam("agentId") Long agentId,
                                     @RequestParam("unfreezeAmount") Long unfreezeAmount);

}
